// 队伍列表
export function TeamList(target) {
  return {
    table: {
      compRef: "pqlist",
      isSequenceFlag: true,
      isShowPage: true,
      stripe: true,
      resetFlag: true,
      loading: false,
      title: "队伍派遣单列表",
      actions: [
        {
          id: "dialogVisible",
          text: "新增",
          type: "primary",
          btnAttr: { size: "small" }
        }
      ],
      tableData: [],
      columns: [
        {
          prop: "resourceDispatchedName",
          label: "资源派遣单",
          align: "left",
          "min-width": "200px",
          render: (h, { row }) => {
            return (
              <div>
                {
                  <span
                    class='commonTableStyle'
                    style='width:100%'
                    {...{
                      on: {
                        click: () => {
                          target.detailList(row.id, row.orderType);
                        }
                      }
                    }}
                  >
                    {row.resourceDispatchedName}
                  </span>
                }
              </div>
            );
          }
        },
        {
          prop: "eventName",
          label: "事件类别",
          align: "center"
        },
        {
          prop: "responseLvName",
          label: "响应等级",
          align: "center"
        },
        {
          prop: "effectRange",
          label: "影响范围",
          align: "left"
        },
        {
          prop: "effectTime",
          label: "影响时间",
          align: "left",
          "min-width": "120px"
        },
        {
          prop: "dutyUnit",
          label: "责任单位及部门",
          align: "center",
          "min-width": "120px"
        },
        {
          prop: "dutyPerson",
          label: "责任人",
          align: "center",
          "min-width": "120px"
        },
        {
          prop: "dispatchedTime",
          label: "派遣时间",
          align: "center",
          "min-width": "140px"
        },
        {
          prop: "sourceInfo",
          label: "响应命令单",
          align: "center",
          "min-width": "230px",
          render: (h, { row }) => {
            return (
              <div>
                {
                  <span
                    class='commonTableStyle'
                    style='width:100%'
                    {...{
                      on: {
                        click: () => {
                          target.goSourceInfo(row.sourceInfoId);
                        }
                      }
                    }}
                  >
                    {row.sourceInfo}
                  </span>
                }
              </div>
            );
          }
        },
        {
          prop: "dispatchedStatusName",
          label: "状态",
          align: "center",
          "min-width": "100px"
        },
        {
          prop: "cz",
          label: "操作",
          align: "center",
          fixed: "right",
          "min-width": "100px",
          render: (h, { row }) => {
            const tbPower = target.common.isHasPower("tbr");
            const spPower = target.common.isHasPower("spr");
            const userId = JSON.parse(sessionStorage.getItem("account")).id;
            return (
              <div>
                {
                  <span
                    style='color:#3561fd;cursor:pointer;text-decoration: underline;'
                    {...{
                      on: {
                        click: () => {
                          target.dispatch(row.id);
                        }
                      }
                    }}
                  >
                    {[2, 6].includes(row.dispatchedStatus) && row.orderType === "apply" && tbPower && row.nextAssignee && row.nextAssignee.includes(userId) ? "派遣" : ""}
                  </span>
                }
                {
                  <span
                    style='color:#3561fd;cursor:pointer;text-decoration: underline;'
                    {...{
                      on: {
                        click: () => {
                          target.apply(row.id, row.orderType);
                        }
                      }
                    }}
                  >
                    {row.dispatchedStatus === 3 && spPower && row.nextAssignee && row.nextAssignee.includes(userId) ? "审批" : ""}
                  </span>
                }
                {
                  <span
                    style='color:#3561fd;cursor:pointer;text-decoration: underline;'
                    {...{
                      on: {
                        click: () => {
                          target.handleEdit(row.id);
                        }
                      }
                    }}
                  >
                    {[1, 6].includes(row.dispatchedStatus) && row.orderType === "dispatched" && tbPower ? "编辑" : ""}
                  </span>
                }
                {
                  <span
                    style='color:#3561fd;cursor:pointer;text-decoration: underline;'
                    class={row.dispatchedStatus === 1 ? "marginL10" : ""}
                    {...{
                      on: {
                        click: () => {
                          target.deleted(row.id);
                        }
                      }
                    }}
                  >
                    {row.dispatchedStatus === 1 && tbPower ? "删除" : ""}
                  </span>
                }
              </div>
            );
          }
        }
      ],
      tableAttr: {
        stripe: false,
        height: "377px",
        border: true,
        fit: true,
        "show-header": true,
        "highlight-current-row": true,
        "cell-style": {
          "font-size": "16px"
        },
        "header-cell-style": {
          "text-align": "center",
          "background-color": "#B1C8F9",
          border: "1px solid #ccc",
          "font-size": "16px"
        }
      },
      paginationAtrrs: {
        total: 0,
        "background": true,
        layout: "prev, pager, next",
        "current-page": 1,
        "page-size": 10
      }
    }
  };
}
// 车辆列表
export function CarList(target) {
  return {
    table: {
      compRef: "pqlist",
      isSequenceFlag: true,
      isShowPage: true,
      resetFlag: true,
      loading: false,
      title: "车辆派遣单列表",
      actions: [
        {
          id: "dialogVisible",
          text: "新增",
          type: "primary",
          btnAttr: { size: "small" }
        }
      ],
      tableData: [],
      columns: [
        {
          prop: "resourceDispatchedName",
          label: "资源派遣单",
          align: "left",
          "min-width": "200px",
          render: (h, { row }) => {
            return (
              <div>
                {
                  <span
                    class='commonTableStyle'
                    style='width:100%'
                    {...{
                      on: {
                        click: () => {
                          target.detailList(row.id, row.orderType);
                        }
                      }
                    }}
                  >
                    {row.resourceDispatchedName}
                  </span>
                }
              </div>
            );
          }
        },
        {
          prop: "eventName",
          label: "事件类别",
          align: "center"
        },
        {
          prop: "responseLvName",
          label: "响应等级",
          align: "center"
        },
        {
          prop: "effectRange",
          label: "影响范围",
          align: "left"
        },
        {
          prop: "effectTime",
          label: "影响时间",
          align: "left",
          "min-width": "120px"
        },

        {
          prop: "dutyUnit",
          label: "责任单位及部门",
          align: "center",
          "min-width": "120px"
        },
        {
          prop: "dutyPerson",
          label: "责任人",
          align: "center",
          "min-width": "120px"
        },
        {
          prop: "dispatchedTime",
          label: "派遣时间",
          align: "center",
          "min-width": "140px"
        },
        {
          prop: "sourceInfo",
          label: "响应命令单",
          align: "center",
          "min-width": "230px",
          render: (h, { row }) => {
            return (
              <div>
                {
                  <span
                    style='width:100%'
                    class='commonTableStyle'
                    {...{
                      on: {
                        click: () => {
                          target.goSourceInfo(row.sourceInfoId);
                        }
                      }
                    }}
                  >
                    {row.sourceInfo}
                  </span>
                }
              </div>
            );
          }
        },
        {
          prop: "dispatchedStatusName",
          label: "状态",
          align: "center",
          "min-width": "100px"
        },
        {
          prop: "cz",
          label: "操作",
          align: "center",
          fixed: "right",
          "min-width": "100px",
          render: (h, { row }) => {
            const tbPower = target.common.isHasPower("tbr");
            const spPower = target.common.isHasPower("spr");
            return (
              <div>
                {
                  <span
                    style='color:#3561fd;cursor:pointer;text-decoration: underline;'
                    {...{
                      on: {
                        click: () => {
                          target.dispatch(row.id);
                        }
                      }
                    }}
                  >
                    {[2, 6].includes(row.dispatchedStatus) && row.orderType === "apply" && tbPower ? "派遣" : ""}
                  </span>
                }
                {
                  <span
                    style='color:#3561fd;cursor:pointer;text-decoration: underline;'
                    {...{
                      on: {
                        click: () => {
                          target.apply(row.id, row.orderType);
                        }
                      }
                    }}
                  >
                    {row.dispatchedStatus === 3 && spPower ? "审批" : ""}
                  </span>
                }
                {
                  <span
                    style='color:#3561fd;cursor:pointer;text-decoration: underline;'
                    {...{
                      on: {
                        click: () => {
                          target.handleEdit(row.id);
                        }
                      }
                    }}
                  >
                    {[1, 6].includes(row.dispatchedStatus) && row.orderType === "dispatched" && tbPower ? "编辑" : ""}
                  </span>
                }
                {
                  <span
                    style='color:#3561fd;cursor:pointer;text-decoration: underline;'
                    class={row.dispatchedStatus === 1 ? "marginL10" : ""}
                    {...{
                      on: {
                        click: () => {
                          target.deleted(row.id);
                        }
                      }
                    }}
                  >
                    {row.dispatchedStatus === 1 && tbPower ? "删除" : ""}
                  </span>
                }
              </div>
            );
          }
        }
      ],
      tableAttr: {
        stripe: false,
        height: "377px",
        border: true,
        fit: true,
        "show-header": true,
        "highlight-current-row": true,
        "cell-style": {
          "font-size": "16px"
        },
        "header-cell-style": {
          "text-align": "center",
          "background-color": "#B1C8F9",
          border: "1px solid #ccc",
          "font-size": "16px"
        }
      },
      paginationAtrrs: {
        total: 0,
        "background": true,
        layout: "prev, pager, next",
        "current-page": 1,
        "page-size": 10
      }
    }
  };
}
// 装备列表
export function EquipmentList(target) {
  return {
    table: {
      compRef: "pqlist",
      isSequenceFlag: true,
      isShowPage: true,
      resetFlag: true,
      loading: false,
      title: "装备派遣单列表",
      actions: [
        {
          id: "dialogVisible",
          text: "新增",
          type: "primary",
          btnAttr: { size: "small" }
        }
      ],
      tableData: [],
      columns: [
        {
          prop: "resourceDispatchedName",
          label: "资源派遣单",
          align: "left",
          "min-width": "200px",
          render: (h, { row }) => {
            return (
              <div>
                {
                  <span
                    class='commonTableStyle'
                    style='width:100%'
                    {...{
                      on: {
                        click: () => {
                          target.detailList(row.id, row.orderType);
                        }
                      }
                    }}
                  >
                    {row.resourceDispatchedName}
                  </span>
                }
              </div>
            );
          }
        },
        {
          prop: "eventName",
          label: "事件类别",
          align: "center"
        },
        {
          prop: "responseLvName",
          label: "响应等级",
          align: "center"
        },
        {
          prop: "effectRange",
          label: "影响范围",
          align: "left"
        },
        {
          prop: "effectTime",
          label: "影响时间",
          align: "left",
          "min-width": "120px"
        },

        {
          prop: "dutyUnit",
          label: "责任单位及部门",
          align: "center",
          "min-width": "120px"
        },
        {
          prop: "dutyPerson",
          label: "责任人",
          align: "center",
          "min-width": "120px"
        },
        {
          prop: "dispatchedTime",
          label: "派遣时间",
          align: "center",
          "min-width": "140px"
        },
        {
          prop: "sourceInfo",
          label: "响应命令单",
          align: "center",
          "min-width": "230px",
          render: (h, { row }) => {
            return (
              <div>
                {
                  <span
                    class='commonTableStyle'
                    style='width:100%'
                    {...{
                      on: {
                        click: () => {
                          target.goSourceInfo(row.sourceInfoId);
                        }
                      }
                    }}
                  >
                    {row.sourceInfo}
                  </span>
                }
              </div>
            );
          }
        },
        {
          prop: "dispatchedStatusName",
          label: "状态",
          align: "center",
          "min-width": "100px"
        },
        {
          prop: "cz",
          label: "操作",
          align: "center",
          fixed: "right",
          "min-width": "100px",
          render: (h, { row }) => {
            const tbPower = target.common.isHasPower("tbr");
            const spPower = target.common.isHasPower("spr");
            return (
              <div>
                {
                  <span
                    style='color:#3561fd;cursor:pointer;text-decoration: underline;'
                    {...{
                      on: {
                        click: () => {
                          target.dispatch(row.id);
                        }
                      }
                    }}
                  >
                    {[2, 6].includes(row.dispatchedStatus) && row.orderType === "apply" && tbPower ? "派遣" : ""}
                  </span>
                }
                {
                  <span
                    style='color:#3561fd;cursor:pointer;text-decoration: underline;'
                    {...{
                      on: {
                        click: () => {
                          target.apply(row.id, row.orderType);
                        }
                      }
                    }}
                  >
                    {row.dispatchedStatus === 3 && spPower ? "审批" : ""}
                  </span>
                }
                {
                  <span
                    style='color:#3561fd;cursor:pointer;text-decoration: underline;'
                    {...{
                      on: {
                        click: () => {
                          target.handleEdit(row.id);
                        }
                      }
                    }}
                  >
                    {[1, 6].includes(row.dispatchedStatus) && row.orderType === "dispatched" && tbPower ? "编辑" : ""}
                  </span>
                }
                {
                  <span
                    style='color:#3561fd;cursor:pointer;text-decoration: underline;'
                    class={row.dispatchedStatus === 1 ? "marginL10" : ""}
                    {...{
                      on: {
                        click: () => {
                          target.deleted(row.id);
                        }
                      }
                    }}
                  >
                    {row.dispatchedStatus === 1 && tbPower ? "删除" : ""}
                  </span>
                }
              </div>
            );
          }
        }
      ],
      tableAttr: {
        stripe: false,
        height: "377px",
        border: true,
        fit: true,
        "show-header": true,
        "highlight-current-row": true,
        "cell-style": {
          "font-size": "16px"
        },
        "header-cell-style": {
          "text-align": "center",
          "background-color": "#B1C8F9",
          border: "1px solid #ccc",
          "font-size": "16px"
        }
      },
      paginationAtrrs: {
        total: 0,
        "background": true,
        layout: "prev, pager, next",
        "current-page": 1,
        "page-size": 10
      }
    }
  };
}
// 物资列表
export function MaterialList(target) {
  return {
    table: {
      compRef: "pqlist",
      isSequenceFlag: true,
      isShowPage: true,
      resetFlag: true,
      loading: false,
      title: "物资派遣单列表",
      actions: [
        {
          id: "dialogVisible",
          text: "新增",
          type: "primary",
          btnAttr: { size: "small" }
        }
      ],
      tableData: [],
      columns: [
        {
          prop: "resourceDispatchedName",
          label: "资源派遣单",
          align: "left",
          "min-width": "200px",
          render: (h, { row }) => {
            return (
              <div>
                {
                  <span
                    class='commonTableStyle'
                    style='width:100%'
                    {...{
                      on: {
                        click: () => {
                          target.detailList(row.id, row.orderType);
                        }
                      }
                    }}
                  >
                    {row.resourceDispatchedName}
                  </span>
                }
              </div>
            );
          }
        },
        {
          prop: "eventName",
          label: "事件类别",
          align: "center"
        },
        {
          prop: "responseLvName",
          label: "响应等级",
          align: "center"
        },
        {
          prop: "effectRange",
          label: "影响范围",
          align: "left"
        },
        {
          prop: "effectTime",
          label: "影响时间",
          align: "left",
          "min-width": "120px"
        },
        {
          prop: "dutyUnit",
          label: "责任单位及部门",
          align: "center",
          "min-width": "120px"
        },
        {
          prop: "dutyPerson",
          label: "责任人",
          align: "center",
          "min-width": "120px"
        },
        {
          prop: "dispatchedTime",
          label: "派遣时间",
          align: "center",
          "min-width": "140px"
        },
        {
          prop: "sourceInfo",
          label: "响应命令单",
          align: "center",
          "min-width": "230px",
          render: (h, { row }) => {
            return (
              <div>
                {
                  <span
                    class='commonTableStyle'
                    style='width:100%'
                    {...{
                      on: {
                        click: () => {
                          target.goSourceInfo(row.sourceInfoId);
                        }
                      }
                    }}
                  >
                    {row.sourceInfo}
                  </span>
                }
              </div>
            );
          }
        },
        {
          prop: "dispatchedStatusName",
          label: "状态",
          align: "center",
          "min-width": "100px"
        },
        {
          prop: "cz",
          label: "操作",
          align: "center",
          fixed: "right",
          "min-width": "100px",
          render: (h, { row }) => {
            const tbPower = target.common.isHasPower("tbr");
            const spPower = target.common.isHasPower("spr");
            return (
              <div>
                {
                  <span
                    style='color:#3561fd;cursor:pointer;text-decoration: underline;'
                    {...{
                      on: {
                        click: () => {
                          target.dispatch(row.id);
                        }
                      }
                    }}
                  >
                    {[2, 6].includes(row.dispatchedStatus) && row.orderType === "apply" && tbPower ? "派遣" : ""}
                  </span>
                }
                {
                  <span
                    style='color:#3561fd;cursor:pointer;text-decoration: underline;'
                    {...{
                      on: {
                        click: () => {
                          target.apply(row.id, row.orderType);
                        }
                      }
                    }}
                  >
                    {row.dispatchedStatus === 3 && spPower ? "审批" : ""}
                  </span>
                }
                {
                  <span
                    style='color:#3561fd;cursor:pointer;text-decoration: underline;'
                    {...{
                      on: {
                        click: () => {
                          target.handleEdit(row.id);
                        }
                      }
                    }}
                  >
                    {[1, 6].includes(row.dispatchedStatus) && row.orderType === "dispatched" && tbPower ? "编辑" : ""}
                  </span>
                }
                {
                  <span
                    style='color:#3561fd;cursor:pointer;text-decoration: underline;'
                    class={row.dispatchedStatus === 1 ? "marginL10" : ""}
                    {...{
                      on: {
                        click: () => {
                          target.deleted(row.id);
                        }
                      }
                    }}
                  >
                    {row.dispatchedStatus === 1 && tbPower ? "删除" : ""}
                  </span>
                }
              </div>
            );
          }
        }
      ],
      tableAttr: {
        stripe: false,
        height: "377px",
        border: true,
        fit: true,
        "show-header": true,
        "highlight-current-row": true,
        "cell-style": {
          "font-size": "16px"
        },
        "header-cell-style": {
          "text-align": "center",
          "background-color": "#B1C8F9",
          border: "1px solid #ccc",
          "font-size": "16px"
        }
      },
      paginationAtrrs: {
        total: 0,
        "background": true,
        layout: "prev, pager, next",
        "current-page": 1,
        "page-size": 10
      }
    }
  };
}
